﻿DECLARE @CurrentMigration [nvarchar](max)

IF object_id('[dbo].[__MigrationHistory]') IS NOT NULL
    SELECT @CurrentMigration =
        (SELECT TOP (1) 
        [Project1].[MigrationId] AS [MigrationId]
        FROM ( SELECT 
        [Extent1].[MigrationId] AS [MigrationId]
        FROM [dbo].[__MigrationHistory] AS [Extent1]
        WHERE [Extent1].[ContextKey] = N'PWManager.Models.PWManagerContext'
        )  AS [Project1]
        ORDER BY [Project1].[MigrationId] DESC)

IF @CurrentMigration IS NULL
    SET @CurrentMigration = '0'

IF @CurrentMigration < '201410280219519_InitialCreate'
BEGIN
    CREATE TABLE [dbo].[Accounts] (
        [Id] [uniqueidentifier] NOT NULL,
        [UserId] [uniqueidentifier] NOT NULL,
        [Name] [nvarchar](20) NOT NULL,
        [LoginName] [nvarchar](20) NOT NULL,
        [LoginPassword] [nvarchar](4000) NOT NULL,
        [Link] [nvarchar](255) NOT NULL,
        [Comments] [nvarchar](4000) NOT NULL,
        CONSTRAINT [PK_dbo.Accounts] PRIMARY KEY ([Id])
    )
    CREATE INDEX [IX_UserId] ON [dbo].[Accounts]([UserId])
    CREATE TABLE [dbo].[Users] (
        [Id] [uniqueidentifier] NOT NULL,
        [Username] [nvarchar](20) NOT NULL,
        [Email] [nvarchar](80) NOT NULL,
        [Password] [nvarchar](4000) NOT NULL,
        [Firstname] [nvarchar](20) NOT NULL,
        [Lastname] [nvarchar](20) NOT NULL,
        CONSTRAINT [PK_dbo.Users] PRIMARY KEY ([Id])
    )
    ALTER TABLE [dbo].[Accounts] ADD CONSTRAINT [FK_dbo.Accounts_dbo.Users_UserId] FOREIGN KEY ([UserId]) REFERENCES [dbo].[Users] ([Id]) ON DELETE CASCADE
    CREATE TABLE [dbo].[__MigrationHistory] (
        [MigrationId] [nvarchar](150) NOT NULL,
        [ContextKey] [nvarchar](300) NOT NULL,
        [Model] [varbinary](max) NOT NULL,
        [ProductVersion] [nvarchar](32) NOT NULL,
        CONSTRAINT [PK_dbo.__MigrationHistory] PRIMARY KEY ([MigrationId], [ContextKey])
    )
    INSERT [dbo].[__MigrationHistory]([MigrationId], [ContextKey], [Model], [ProductVersion])
    VALUES (N'201410280219519_InitialCreate', N'PWManager.Models.PWManagerContext',  0x1F8B0800000000000400E55ADB6EE336107D2FD07F10F458642D27DB05D2C0DE45EA248BA0B921CE6EFB1630D2D8219622B52295DA28FA657DE827F5173AD45DA4ACC8719C6C5104086C9273E6C299E1CC24FFFCF5F7E8C32264CE03C4920A3E76770743D701EE8B80F2F9D84DD4ECCDBEFBE1FDF7DF8D8E8370E17C2ECEBDD5E79092CBB17BAF5474E079D2BF8790C84148FD58483153035F841E0984B7371CFEE4EDEE7A80102E6239CEE83AE18A86907EC1AF13C17D885442D8B90880C97C1D77A629AA7341429011F161EC5EFD7A4E3899433CC8CEBACE21A304E598029BB90EE15C28A250CA834F12A62A167C3E8D7081B09B6504786E4698845CFA83EA785F45867B5A11AF222CA0FC442A11AE09B8FB36B78C67923FC9BE6E6939B4DD31DA582DB5D6A9FDC6EEA1EF0B34BCEB98BC0E262CD6E76CEB0E729A1DA7DCD929DD00BD45FFEC389384A92486318744C584E1E1E48E51FF1758DE882FC0C73C61AC2E1A0A877B8D055CBA8A4504B15A5EC32C17F834701DAF49E7998425598D26D3E56342F1F305F226770CCA8BF73AC9D169E20D21F4EF02001D1023C975CEC9E20CF85CDD8FDD3D0C9D13BA80A058C8413F718A7187342A4E606DA667624EF9EB71BE2252FE2EE2A083FB8FC3E176F853FEA54BE977EF7A71ED66321161085CC9E7D0CFE074411EE83C0DC31657749D6B60E9A6BCA75196E4067AE3360F4C94E82416E1B5603945B9717B43E23960B4DF88B6DDA94862DF9066E45539A3339364A2AD914634C1FF2A87F0D708C5E39050D6C1757F2B5C5F31F64F682CD5AB98FA8CBC14E395F9A1CA004FCF11451668CF114506E993230EA5143E4DC5A88541254253A9631E389DF264462D3441BB627AA0112604648D75AA6B06FE253F02060A9C433F2BBE2644FA24B0CD89E207FD6429F367254B594135C5F9C1E282F907627C30B0ECC4E2566246A35CD9C98A729F46847599C220EA99E3B4A225BCB9730411F000A5EB52BB0FDFA258B279972C0CE33F66979157F323FB09421A85141017A9A77850F4062CDA4A5B94317F96641E71E6ED6BE029282BAA2A3F376FDFEB86D06669A3CF3CD920AEE9DB44A8456FED4C6B789BE67F2CBA4A814B59AD1B7C2C286A10959C66A835756B4922E57D561D9F97B57C456BE8ADE80D47E7248A30E3D67AC57CC599668DE2E4CD74FD1E2ACC303C5FB6B452A5B425272562F43E6357578B01A44FD31151E48EE8A43E0942EB98E5BD2BDCAA606738A87D6585BF1504FAB31128465FD712E639F1096AA64BDE5449B0AFDBA64CDB75C248DC524D4D044B42BE3A5BADA62E724C1D6155DE598D927546758C6CA53F42ADC1AAC3D496D7C4AACA260BAFDA5A03336D831A50E94A7F84AAC7A9A354AB36D2C8339CC57A072C9FB41EE3A68FF78A802C676DE4FE692A5EDFF7DBC9B6E7F8DCF2B76AB53F52DE16D461F2A5FE18EDDEFA1447ADD5EC75A8DAF21A4E4FDAA0AAD5177659EB59338F94DCCBE7CD78C646F993F2F81CD47A63B223AE83267AA0817E5FA64BA9201CE80383E95736611474F5521CC090A033902AEBAFB15DD9DD3386A9DFCE60D3933260FDA69B2F3E234838FD9A00D5D52E9D515DE26D3473B4E1AC9AF6144BEBC5D8FD23A53F704E7FBBCD20769CCB182FF6C0193A7F6E34B6E40F24F6EF496CF5B39B4E259F15D81C3CB48267A3870D668AED22EBA96205FA9411622F696DE0F56674FFCD60E05BF098C66CAC15747F7DD0ED79A035D97AB6C821CF81BB8D29D06B4D7DCAB6FE45073D2F31D859DDE47D83B31CBB69EE35A8E99AD36425D1D80DEE04DE6EE6CC2BA7156D539C95439C36E4D651CA0BCC77AC794EE738C7305BA3A5DFCA00C7AE68D1756A7FFF47AF95745E41E8FF06E0E0379CA63C73CA67A2F05D43A2E28891EFCE4191003DEA30C60789F80AB77D90321DD67F262C499F863B084EF965A2A244A1CA10DEB165DD183A06BAF8A753AAA6CCA3CB289DC83F870A28264515E092FF9C501694729FB4E4E515103AB83E02AE677789B1AA60BE2C912E04EF09949BAFCC093710460CC1E4259F9207788A6CE8B2673027FEB2684C56833C7E114DB38F8E2899C724943946458F5FD1878370F1FE5FF42C99EB06230000 , N'6.1.1-30610')
END

IF @CurrentMigration < '201410280339577_ChangeColumnProperty'
BEGIN
    ALTER TABLE [dbo].[Accounts] ALTER COLUMN [Link] [nvarchar](255) NULL
    ALTER TABLE [dbo].[Accounts] ALTER COLUMN [Comments] [nvarchar](4000) NULL
    INSERT [dbo].[__MigrationHistory]([MigrationId], [ContextKey], [Model], [ProductVersion])
    VALUES (N'201410280339577_ChangeColumnProperty', N'PWManager.Models.PWManagerContext',  0x1F8B0800000000000400E55ADB6EE336107D2FD07F10F458642D27DB05D2C0DE45EA248BA0B921CE6EFB1630D2D8219622B52295DA28FA657DE827F5173AD45DA4ACC8719C6C5104086C9273E6C299E1CC24FFFCF5F7E8C32264CE03C4920A3E76770743D701EE8B80F2F9D84DD4ECCDBEFBE1FDF7DF8D8E8370E17C2ECEBDD5E79092CBB17BAF5474E079D2BF8790C84148FD58483153035F841E0984B7371CFEE4EDEE7A80102E6239CEE83AE18A86907EC1AF13C17D885442D8B90880C97C1D77A629AA7341429011F161EC5EFD7A4E3899433CC8CEBACE21A304E598029BB90EE15C28A250CA834F12A62A167C3E8D7081B09B6504786E4698845CFA83EA785F45867B5A11AF222CA0FC442A11AE09B8FB36B78C67923FC9BE6E6939B4DD31DA582DB5D6A9FDC6EEA1EF0B34BCEB98BC0E262CD6E76CEB0E729A1DA7DCD929DD00BD45FFEC389384A92486318744C584E1E1E48E51FF1758DE882FC0C73C61AC2E1A0A877B8D055CBA8A4504B15A5EC32C17F834701DAF49E7998425598D26D3E56342F1F305F226770CCA8BF73AC9D169E20D21F4EF02001D1023C975CEC9E20CF85CDD8FDD3D0C9D13BA80A058C8413F718A7187342A4E606DA667624EF9EB71BE2252FE2EE2A083FB8FC3E176F853FEA54BE977EF7A71ED66321161085CC9E7D0CFE074411EE83C0DC31657749D6B60E9A6BCA75196E4067AE3360F4C94E82416E1B5603945B9717B43E23960B4DF88B6DDA94862DF9066E45539A3339364A2AD914634C1FF2A87F0D708C5E39050D6C1757F2B5C5F31F64F682CD5AB98FA8CBC14E395F9A1CA004FCF11451668CF114506E993230EA5143E4DC5A88541254253A9631E389DF264462D3441BB627AA0112604648D75AA6B06FE253F02060A9C433F2BBE2644FA24B0CD89E207FD6429F367254B594135C5F9C1E282F907627C30B0ECC4E2566246A35CD9C98A729F46847599C220EA99E3B4A225BCB9730411F000A5EB52BB0FDFA258B279972C0CE33F66979157F323FB09421A85141017A9A77850F4062CDA4A5B94317F96641E71E6ED6BE029282BAA2A3F376FDFEB86D06669A3CF3CD920AEE9DB44A8456FED4C6B789BE67F2CBA4A814B59AD1B7C2C286A10959C66A835756B4922E57D561D9F97B57C456BE8ADE80D47E7248A30E3D67AC57CC599668DE2E4CD74FD1E2ACC303C5FB6B452A5B425272562F43E6357578B01A44FD31151E48EE8A43E0942EB98E5BD2BDCAA606738A87D6585BF1504FAB31128465FD712E639F1096AA64BDE5449B0AFDBA64CDB75C248DC524D4D044B42BE3A5BADA62E724C1D6155DE598D927546758C6CA53F42ADC1AAC3D496D7C4AACA260BAFDA5A03336D831A50E94A7F84AAC7A9A354AB36D2C8339CC57A072C9FB41EE3A68FF78A802C676DE4FE692A5EDFF7DBC9B6E7F8DCF2B76AB53F52DE16D461F2A5FE18EDDEFA1447ADD5EC75A8DAF21A4E4FDAA0AAD5177659EB59338F94DCCBE7CD78C646F993F2F81CD47A63B223AE83267AA0817E5FA64BA9201CE80383E95736611474F5521CC090A033902AEBAFB15DD9DD3386A9DFCE60D3933260FDA69B2F3E234838FD9A00D5D52E9D515DE26D3473B4E1AC9AF6144BEBC5D8FD23A53F704E7FBBCD20769CCB182FF6C0193A7F6E34B6E40F24F6EF496CF5B39B4E259F15D81C3CB48267A3870D668AED22EBA96205FA9411622F696DE0F56674FFCD60E05BF098C66CAC15747F7DD0ED79A035D97AB6C821CF81BB8D29D06B4D7DCAB6FE45073D2F31D859DDE47D83B31CBB69EE35A8E99AD36425D1D80DEE04DE6EE6CC2BA7156D539C95439C36E4D651CA0BCC77AC794EE738C7305BA3A5DFCA00C7AE68D1756A7FFF47AF95745E41E8FF06E0E0379CA63C73CA67A2F05D43A2E28891EFCE4191003DEA30C60789F80AB77D90321DD67F262C499F863B084EF965A2A244A1CA10DEB165DD183A06BAF8A753AAA6CCA3CB289DC83F870A28264515E092FF9C501694729FB4E4E515103AB83E02AE677789B1AA60BE2C912E04EF09949BAFCC093710460CC1E4259F9207788A6CE8B2673027FEB2684C56833C7E114DB38F8E2899C724943946458F5FD1878370F1FE5FF42C99EB06230000 , N'6.1.1-30610')
END

IF @CurrentMigration < '201410281701378_ColumnLengthChange'
BEGIN
    ALTER TABLE [dbo].[Accounts] ALTER COLUMN [LoginName] [nvarchar](80) NOT NULL
    INSERT [dbo].[__MigrationHistory]([MigrationId], [ContextKey], [Model], [ProductVersion])
    VALUES (N'201410281701378_ColumnLengthChange', N'PWManager.Models.PWManagerContext',  0x1F8B0800000000000400E55ADB6EE336107D2FD07F10F458642D27DB0552C3DE45EA248BA0B921CE6EFB1630D2D8219622B52495DA28FA657DE827F5173ABA4BA4ECC84EEC6C5104086C9273E6C299E1CC24FFFCF5F7F0C33C64CE234845051FB9FBBDBEEB00F74540F96CE4C67AFAE6D0FDF0FEFBEF86274138773E17E7DE26E79092AB91FBA07534F03CE53F4048542FA4BE144A4C75CF17A14702E11DF4FB3F79FBFB1E20848B588E33BC89B9A621A45FF0EB58701F221D13762102602A5FC79D498AEA5C921054447C18B9D7BF5E104E66207BD959D7396294A01C136053D7219C0B4D344A39F8A460A2A5E0B349840B84DD2E22C07353C214E4D20FAAE35D15E91F248A78156101E5C74A8B704DC0FDB7B9653C937C23FBBAA5E5D076276863BD48B44EED37728F7C5FA0E15DC7E4351833999CB3ADDBCB69F69C7267AF7403F496E467CF19C74CC712461C622D09C3C3F13DA3FE2FB0B8155F808F78CC585D34140EF71A0BB8742D4504522F6E609A0B7C16B88ED7A4F34CC292AC4693E9F231A6F8F91279937B06E5C57B2BC9D169E4332192DF05003A204692EB5C90F939F0997E18B907183AA7740E41B190837EE214E30E69B48C616DA6E76246F9139C0FB7C7F99A28F5BB90C10AEE3FF6FBDBE14FF99755E67EF7AE13D7D54CC6220C816BF512FA199C2EC9239DA561D8E28AAE73032CDD540F34CA925C2FD9B8CB0313253A9522BC112CA72837EE6E899C0146FBAD68DB9D8858FA863443AFCA192B334926DA1A692421F85FE510FE1A49E0242494ED3C01BC62EC9F52A9F4AB98FA9CEC8AF1D2FC506580CD73449105DA73449141BAE48823A5844F53316A615089D054EA8407CE4A7932A3169AA05D313DD0081302B2C63AD53503FF8A1F03030DCE919F155F63A27C12D8E644F1836EB294F9B392A5ACA09AE2FC6071C1FC03121F0C2C3BB1B85598D128D776B2A2DCA71161AB4C611075CC7189A225BCB9730C11F000A55BA57617BE45B164F32E5918C67FCA2E43AFE647F61384341A294016A9A77850920D98B795B62863FE2CA93CE2CCDB4F8027A0ADA8AAFCDCBC7D6F3544629636FACC930DE29ABE4D845AF4D6CEB486B769FEA7A2AB14B894D5BAC1A782A20651C969865A53B7962452DE67D5F17959CB57B486DE92DE707841A208336EAD57CC579C49D6288EDF4CD6EFA1C20CC3F3554B2B554A5B72D242A2F719BB49B51840FA341D134DEE4992D4C741681DB3BC77895B15EC0C07B5AFACF0B78220F96C048AD1D7B584794E7C8A9A25256FAA24D8D76D53A6ED3A6144B6545363C1E2902FCF56CBA98B1C534758967796A3649D511D235BE98E506BB0EA30B5E535B1AAB2C9C2ABB6D6C04CDBA00654BAD21DA1EA71EA28D5AA8D34F40C67B1DE01CB27ADC7B8E9E39D2220CB59CF72FF3415AFEFFBED64DB737C6EF95BB5DA1D296F0BEA30F952778C766FDDC4516B357B1DAAB6BC86D39336A86A75C72E6B3D6BE691927BF9BC19CFD8307F529E9E835A6F4C76C475D0448F3448DE97C94269087BC981DEE42B1B330A49F5521CC090A053503AEBAFB15DD93F3086A9DFCE60D3532A60DDA69B3B9F11C49C7E8D8126D52E9DD2A4C47BD6CCD186B36ADA332CADE723F78F947EE09CFD769741EC3957122F76E0F49D3F9F35B6E48F44FA0F445AFDEC73A792ADC0871B029B838756F06CF4F08C9962BB2D92A96205BAC908B193B436F07A33BAFF6630F02DB8626336F6526EB83D0FB4265B2F1692E42570B731057AADA94FD9D6EF74D0B38BC1CEF226EF1B9CE5D84D73A741CDAA394D56128DDCE05EE0ED66CEBC745AD136C5593AC469436E1DA5EC60BE63CD73568E730CB3355AFAAD0C70EC8A165DA7F6F77FF45A45671544F2DF001CFC86D39467CEF85414BE6B48541C31F2DD056812A0471D497C9088AF71DB07A5D261FD67C2E2F469B887E08C5FC53A8A35AA0CE13D5BD48D91C4C02AFEE994AA29F3F02A4A27F22FA1028A495105B8E23FC79405A5DCA72D79790944125C1F01D7B3BBC458D5305B944897827704CACD57E6845B08238660EA8A4FC8236C221BBAEC39CC88BF281A93E5204F5F44D3ECC3634A6692842AC7A8E8F12BFA7010CEDFFF0B498BCC7F06230000 , N'6.1.1-30610')
END

IF @CurrentMigration < '201410281726532_ColumnLengthChange1'
BEGIN
    ALTER TABLE [dbo].[Accounts] ALTER COLUMN [Name] [nvarchar](80) NOT NULL
    ALTER TABLE [dbo].[Accounts] ALTER COLUMN [LoginPassword] [nvarchar](255) NOT NULL
    INSERT [dbo].[__MigrationHistory]([MigrationId], [ContextKey], [Model], [ProductVersion])
    VALUES (N'201410281726532_ColumnLengthChange1', N'PWManager.Models.PWManagerContext',  0x1F8B0800000000000400E55A6D6FDB3610FE3E60FF41D0C721B59C7405BAC06E913949112C6F88D36EDF02463A3B44295225A9CCC6B05FB60FFB49FB0B3BBD4BA4ACC876E27618020436C97BEE787CEEC8BBE49FBFFE1EBD5F84CC7904A9A8E063777F30741DE0BE08289F8FDD58CF5EBD75DFBFFBFEBBD149102E9C4FC5BAD7C93A94E46AEC3E681D1D7A9EF21F20246A10525F0A25667AE08BD02381F00E86C39FBCFD7D0F10C2452CC719DDC45CD310D22FF87522B80F918E09BB100130958FE3CC3445752E49082A223E8CDDEB5F2F08277390836CADEB1C314AD08E29B099EB10CE85261AAD3CFCA860AAA5E0F369840384DD2E23C07533C214E4D61F56CBFB6E6478906CC4AB040B283F565A846B02EEBFCE3DE399E21BF9D72D3D87BE3B411FEB65B2EBD47F63F7C8F7053ADE754C5D8713269375B67707B9CC9E53CEEC953440B6243F7BCE24663A9630E6106B49182E8EEF19F57F81E5ADF80C7CCC63C6EAA6A17138D718C0A16B2922907A7903B3DCE0B3C075BCA69C670A966235996C2F1F628A9F2F5137B967501EBCD7298EA4915B4224BF0B0024204692EB5C90C539F0B97E18BB6F31744EE90282622007FDC829C61DCA6819C3DA4ACFC59CF2AFA7F99A28F5BB904187F683376F5E443DE59F9F416BB792890843E05A7528FA7138ECE75E43D32579A4F3340A5B98E83A37C0D249F540A32CC70D9289BB3C2ED1A25329C21BC1728972E2EE96C83960B0DF8AB6D9A988A56F5833F2AA94D1994832D3D6C82289C0FF2A85F0EE483C7891483C0909653B8FFF1EA1DF3B36D6547D4AA5D25FC5D5E764578A57E6872A036C9E238A2CD09E238A0CD227471C29257C9A9A510B83CA84E6A64E78E074DA9339B5D809FA15D3038D3021A06A7CA6BA66E05FF16360A0C139F2B3B7D784289F04B63BD1FCA09F2D65FEAC6C291F504D737EB0B460FE01891706BE3AF16DAB30A351AEED6445B94F23C2BA5C6108F5CC71C9464B7873E61822E0015AD7B5ED3E7A8BB792ADBB546138FF29BF8CBC1A8FEC2B0865344A802C524F71A12413B0687BD9A28DF9B5A4F288334F3F019E82B6A2AAE2B979FA5E3744E29636F98CC986706DBF4D845AF4D6D6B486B7E9FEA7A2AB34B8B4D53AC1A782A20651D969865A736F2D49A43CCFAAE0F3B28AAFA80CBD15A5E1E882441166DC5AA9988F38D3AC4E9CBC9AAE5F42851986E7AB964AAAB4B6D4A48544F619B3C96B3180F46A3A269ADC9324A94F82D05A66B17705AD0A750641ED232BF85608249F8D4031CABA9630CF854F7167C99337DD24D8C76D4BA6D53A6144B6BCA62682C5215F9DAD564B1739A68EB02AEFAC46C90AA33A4636D21FA1565FD5616AC36B6255CF260BAF9A5A03332D831A50E9487F84AAC6A9A354A336D2C833C862DD031627ADCBB8C9F15E1190E5ACADE89FA6E2F5B9DF2EF672C4E716DFAAD1FE4879595087C987FA63B4B37513A2D6DEEC75A8DAF01AA4276D50D5E88E296B5D6BE692527B79BD19D7D828BF529E6E835A774CB6C475D0458F3448EE97E952690807C982C1F40B9B300AC9EBA55880214167A074565F63B9B27F60F452BF9DBEA6A754C0FA353777DE238839FD12034D5EBB74469327DE562D471BCE7AD39EE1D37A3176FF48E50F9DB3DFEE32883DE74AE2C11E3A43E7CFADBA96FC9148FF8148AB7BB06D53F25981CDC6432B78DAFFDBA2A5D80774930E622B6ED627E9025EAF45F7DF8C05FE14610ED6274CA335F65C2CEC4540F34C376B6C3D971FCCBED566B82FD104FA5A4D9FB2AADF699F67177D9DD535DE37D8CAB16BE65E7D9AAE364DF6221ABBC1BDC0D3CDC8BCB259D1D6C459D9C369436EEDA4ECA0BD63B5733ABB3986DB1A15FD8BF46FEC072D52A7F6D77F64ADA2F30A22F95F000E7E8334E59A333E1305770D8B8A2546BEBB004D0264D491C40B89F81AA77D502AEDD57F222C4EAF867B08CEF855ACA358E39621BC67CBBA339218E8D29F36A99A368FAEA2B421FF1C5B4033296E01AEF8CF31654169F7694B5E5E019104D707C0F1EC2C315635CC9725D2A5E03D8172F79539E116C2882198BAE253F2089BD886943D8739F197455DB21AE4E98368BA7D744CC95C9250E518953C7E450E07E1E2DDBFF75649AD04230000 , N'6.1.1-30610')
END

IF @CurrentMigration < '201410290554320_DatabaseUpdate'
BEGIN
    ALTER TABLE [dbo].[Accounts] ALTER COLUMN [Name] [nvarchar](80) NOT NULL
    ALTER TABLE [dbo].[Accounts] ALTER COLUMN [LoginName] [nvarchar](80) NOT NULL
    ALTER TABLE [dbo].[Accounts] ALTER COLUMN [LoginPassword] [nvarchar](4000) NOT NULL
    INSERT [dbo].[__MigrationHistory]([MigrationId], [ContextKey], [Model], [ProductVersion])
    VALUES (N'201410290554320_DatabaseUpdate', N'PWManager.Models.PWManagerContext',  0x1F8B0800000000000400E55ADB6EE336107D2FD07F10F458642D27DB05D2C0DE45EA248BA0B921CE6EFB1630D2D8219622B52295DA28FA657DE827F5173AD45DA4ACC8719C6C5104086C9273E6C299E1CC24FFFCF5F7E8C32264CE03C4920A3E76770743D701EE8B80F2F9D84DD4ECCDBEFBE1FDF7DF8D8E8370E17C2ECEBDD5E79092CBB17BAF5474E079D2BF8790C84148FD58483153035F841E0984B7371CFEE4EDEE7A80102E6239CEE83AE18A86907EC1AF13C17D885442D8B90880C97C1D77A629AA7341429011F161EC5EFD7A4E3899433CC8CEBACE21A304E598029BB90EE15C28A250CA834F12A62A167C3E8D7081B09B6504786E4698845CFA83EA785F45867B5A11AF222CA0FC442A11AE09B8FB36B78C67923FC9BE6E6939B4DD31DA582DB5D6A9FDC6EEA1EF0B34BCEB98BC0E262CD6E76CEB0E729A1DA7DCD929DD00BD45FFEC389384A92486318744C584E1E1E48E51FF1758DE882FC0C73C61AC2E1A0A877B8D055CBA8A4504B15A5EC32C17F834701DAF49E7998425598D26D3E56342F1F305F226770CCA8BF73AC9D169E20D21F4EF02001D1023C975CEC9E20CF85CDD8FDD3D0C9D13BA80A058C8413F718A7187342A4E606DA667624EF9EB71BE2252FE2EE2A083FB8FC3E176F853FEA54BE977EF7A71ED66321161085CC9E7D0CFE074411EE83C0DC31657749D6B60E9A6BCA75196E4067AE3360F4C94E82416E1B5603945B9717B43E23960B4DF88B6DDA94862DF9066E45539A3339364A2AD914634C1FF2A87F0D708C5E39050D6C1757F2B5C5F31F64F682CD5AB98FA8CBC14E395F9A1CA004FCF11451668CF114506E993230EA5143E4DC5A88541254253A9631E389DF264462D3441BB627AA0112604648D75AA6B06FE253F02060A9C433F2BBE2644FA24B0CD89E207FD6429F367254B594135C5F9C1E282F907627C30B0ECC4E2566246A35CD9C98A729F46847599C220EA99E3B4A225BCB9730411F000A5EB52BB0FDFA258B279972C0CE33F66979157F323FB09421A85141017A9A77850F4062CDA4A5B94317F96641E71E6ED6BE029282BAA2A3F376FDFEB86D06669A3CF3CD920AEE9DB44A8456FED4C6B789BE67F2CBA4A814B59AD1B7C2C286A10959C66A835756B4922E57D561D9F97B57C456BE8ADE80D47E7248A30E3D67AC57CC599668DE2E4CD74FD1E2ACC303C5FB6B452A5B425272562F43E6357578B01A44FD31151E48EE8A43E0942EB98E5BD2BDCAA606738A87D6585BF1504FAB31128465FD712E639F1096AA64BDE5449B0AFDBA64CDB75C248DC524D4D044B42BE3A5BADA62E724C1D6155DE598D927546758C6CA53F42ADC1AAC3D496D7C4AACA260BAFDA5A03336D831A50E94A7F84AAC7A9A354AB36D2C8339CC57A072C9FB41EE3A68FF78A802C676DE4FE692A5EDFF7DBC9B6E7F8DCF2B76AB53F52DE16D461F2A5FE18EDDEFA1447ADD5EC75A8DAF21A4E4FDAA0AAD5177659EB59338F94DCCBE7CD78C646F993F2F81CD47A63B223AE83267AA0817E5FA64BA9201CE80383E95736611474F5521CC090A033902AEBAFB15DD9DD3386A9DFCE60D3933260FDA69B2F3E234838FD9A00D5D52E9D515DE26D3473B4E1AC9AF6144BEBC5D8FD23A53F704E7FBBCD20769CCB182FF6C0193A7F6E34B6E40F24F6EF496CF5B39B4E259F15D81C3CB48267A3870D668AED22EBA96205FA9411622F696DE0F56674FFCD60E05BF098C66CAC15747F7DD0ED79A035D97AB6C821CF81BB8D29D06B4D7DCAB6FE45073D2F31D859DDE47D83B31CBB69EE35A8E99AD36425D1D80DEE04DE6EE6CC2BA7156D539C95439C36E4D651CA0BCC77AC794EE738C7305BA3A5DFCA00C7AE68D1756A7FFF47AF95745E41E8FF06E0E0379CA63C73CA67A2F05D43A2E28891EFCE4191003DEA30C60789F80AB77D90321DD67F262C499F863B084EF965A2A244A1CA10DEB165DD183A06BAF8A753AAA6CCA3CB289DC83F870A28264515E092FF9C501694729FB4E4E515103AB83E02AE677789B1AA60BE2C912E04EF09949BAFCC093710460CC1E4259F9207788A6CE8B2673027FEB2684C56833C7E114DB38F8E2899C724943946458F5FD1878370F1FE5FF42C99EB06230000 , N'6.1.1-30610')
END

IF @CurrentMigration < '201410310328203_Hotfix_2014_10_30'
BEGIN
    ALTER TABLE [dbo].[Accounts] ALTER COLUMN [LoginName] [nvarchar](80) NOT NULL
    INSERT [dbo].[__MigrationHistory]([MigrationId], [ContextKey], [Model], [ProductVersion])
    VALUES (N'201410310328203_Hotfix_2014_10_30', N'PWManager.Models.PWManagerContext',  0x1F8B0800000000000400E55ADB6EE336107D2FD07F10F458642D27DB0552C3DE45EA248BA0B921CE6EFB1630D2D8219622B52495DA28FA657DE827F5173ABA4BA4ECC84EEC6C5104086C9273E6C299E1CC24FFFCF5F7F0C33C64CE234845051FB9FBBDBEEB00F74540F96CE4C67AFAE6D0FDF0FEFBEF86274138773E17E7DE26E79092AB91FBA07534F03CE53F4048542FA4BE144A4C75CF17A14702E11DF4FB3F79FBFB1E20848B588E33BC89B9A621A45FF0EB58701F221D13762102602A5FC79D498AEA5C921054447C18B9D7BF5E104E66207BD959D7396294A01C136053D7219C0B4D344A39F8A460A2A5E0B349840B84DD2E22C07353C214E4D20FAAE35D15E91F248A78156101E5C74A8B704DC0FDB7B9653C937C23FBBAA5E5D076276863BD48B44EED37728F7C5FA0E15DC7E4351833999CB3ADDBCB69F69C7267AF7403F496E467CF19C74CC712461C622D09C3C3F13DA3FE2FB0B8155F808F78CC585D34140EF71A0BB8742D4504522F6E609A0B7C16B88ED7A4F34CC292AC4693E9F231A6F8F91279937B06E5C57B2BC9D169E4332192DF05003A204692EB5C90F939F0997E18B907183AA7740E41B190837EE214E30E69B48C616DA6E76246F9139C0FB7C7F99A28F5BB90C10AEE3FF6FBDBE14FF99755E67EF7AE13D7D54CC6220C816BF512FA199C2EC9239DA561D8E28AAE73032CDD540F34CA925C2FD9B8CB0313253A9522BC112CA72837EE6E899C0146FBAD68DB9D8858FA863443AFCA192B334926DA1A692421F85FE510FE1A49E0242494ED3C01BC62EC9F52A9F4AB98FA9CEC8AF1D2FC506580CD73449105DA73449141BAE48823A5844F53316A615089D054EA8407CE4A7932A3169AA05D313DD0081302B2C63AD53503FF8A1F03030DCE919F155F63A27C12D8E644F1836EB294F9B392A5ACA09AE2FC6071C1FC03121F0C2C3BB1B85598D128D776B2A2DCA71161AB4C611075CC7189A225BCB9730C11F000A55BA57617BE45B164F32E5918C67FCA2E43AFE647F61384341A294016A9A77850920D98B795B62863FE2CA93CE2CCDB4F8027A0ADA8AAFCDCBC7D6F3544629636FACC930DE29ABE4D845AF4D6CEB486B769FEA7A2AB14B894D5BAC1A782A20651C969865A53B7962452DE67D5F17959CB57B486DE92DE707841A208336EAD57CC579C49D6288EDF4CD6EFA1C20CC3F3554B2B554A5B72D242A2F719BB49B51840FA341D134DEE4992D4C741681DB3BC77895B15EC0C07B5AFACF0B78220F96C048AD1D7B584794E7C8A9A25256FAA24D8D76D53A6ED3A6144B6545363C1E2902FCF56CBA98B1C534758967796A3649D511D235BE98E506BB0EA30B5E535B1AAB2C9C2ABB6D6C04CDBA00654BAD21DA1EA71EA28D5AA8D34F40C67B1DE01CB27ADC7B8E9E39D2220CB59CF72FF3415AFEFFBED64DB737C6EF95BB5DA1D296F0BEA30F952778C766FDDC4516B357B1DAAB6BC86D39336A86A75C72E6B3D6BE691927BF9BC19CFD8307F529E9E835A6F4C76C475D0448F3448DE97C94269087BC981DEE42B1B330A49F5521CC090A053503AEBAFB15DD93F3086A9DFCE60D3532A60DDA69B3B9F11C49C7E8D8126D52E9DD2A4C47BD6CCD186B36ADA332CADE723F78F947EE09CFD769741EC3957122F76E0F49D3F9F35B6E48F44FA0F445AFDEC73A792ADC0871B029B838756F06CF4F08C9962BB2D92A96205BAC908B193B436F07A33BAFF6630F02DB8626336F6526EB83D0FB4265B2F1692E42570B731057AADA94FD9D6EF74D0B38BC1CEF226EF1B9CE5D84D73A741CDAA394D56128DDCE05EE0ED66CEBC745AD136C5593AC469436E1DA5EC60BE63CD73568E730CB3355AFAAD0C70EC8A165DA7F6F77FF45A45671544F2DF001CFC86D39467CEF85414BE6B48541C31F2DD056812A0471D497C9088AF71DB07A5D261FD67C2E2F469B887E08C5FC53A8A35AA0CE13D5BD48D91C4C02AFEE994AA29F3F02A4A27F22FA1028A495105B8E23FC79405A5DCA72D79790944125C1F01D7B3BBC458D5305B944897827704CACD57E6845B08238660EA8A4FC8236C221BBAEC39CC88BF281A93E5204F5F44D3ECC3634A6692842AC7A8E8F12BFA7010CEDFFF0B498BCC7F06230000 , N'6.1.1-30610')
END

